<template>
  <div class="header">
    <div class="header-lt">
      <span class="iconfont">&#xe624;</span>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe632;</span>输入景点/城市/游玩主题
    </div>
    <div class="header-rt" @click="selectCity">
      <span class="content" v-text="this.city"></span>
      <span class="iconfont arrowIcon" v-if="this.city">&#xe64a;</span>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
export default {
  name: 'HomeHeader',
  methods: {
    selectCity () {
      this.$router.push({ name: 'City', query: { id: this.city } })
    }
  },
  computed: {
    ...mapState(['city'])
  }
}
</script>

<style lang="stylus" scoped>
@import '~@styles/varibles.styl'
@import '~@styles/mixins.styl'
.header{
  height $headerHeight
  line-height $headerHeight
  display flex
  background $bgColor
  color #fff
  .header-lt{
    width 0.84rem
    float left
    text-align center
  }
  .header-input{
    flex 1
    height 0.64rem
    line-height 0.64rem
    background-color #ffffff
    border-radius 0.1rem
    margin-top 0.12rem
    margin-left 0.2rem
    padding-left 0.2rem
    color #ccc
    span{
      margin-right 0.05rem
    }
  }
  .header-rt {
    width 1.44rem
    float left
    text-align center
    padding-left 0.1rem
    .content{
      width 1rem
      display inline-block
      ellipsis()
    }
    .arrowIcon{
      float right
      font-size 0.2rem
      margin-right 0.15rem
    }
  }
}
</style>
